import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/components/Home.vue'
import VisitList from '@/components/VisitList.vue'
import PersonnelList from '@/components/PersonnelList.vue'
import Login from '@/components/Login.vue'
Vue.use(VueRouter)

// 解决重复点击导航路由报错
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
}





const routes = [
  {
    path: '/',
    component: Home,
    children:[
      {path:'/',redirect:'/visitList'},
      {path:'/visitList',component:VisitList},
      {path:'/personnelList',component:PersonnelList},
    
    ]
  },
  {path:'/login',component:Login}
]

const router = new VueRouter({
  routes
})

export default router
